<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost/" />
<title>CreateOpportunity</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Create Opportunity</td></tr>
</thead><tbody>
<tr>
  <td>setTimeout</td>
  <td>45000</td>
  <td></td>
</tr>
<tr>
  <td>storeGlobal</td>
  <td>javascript{Math.floor(Math.random()*11000)}</td>
  <td>randomSuffix</td>
</tr>
<!--store current date-->
<tr>
	<td>storeGlobal</td>
	<td>javascript{new Date().getDate().toString()}</td>
	<td>date</td>
</tr>
<!--store current month-->
<tr>
	<td>storeGlobal</td>
	<td>javascript{(new Date().getMonth()) + 1}</td>
	<td>month</td>
</tr>
<!--create account to link with opportunity-->
<tr>
  <td>open</td>
  <td>index.php/accounts/default/create</td>
  <td></td>
</tr>
<tr>
  <td>waitForPageToLoad</td>
  <td></td>
  <td></td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<tr>
  <td>waitForTextPresent</td>
  <td>Create Account</td>
  <td></td>
</tr>
<tr>
  <td>type</td>
  <td>Account_name</td>
  <td>Test Account ${randomSuffix}</td>
</tr>
<tr>
  <td>clickAndWait</td>
  <td>save</td>
  <td></td>
</tr>
<tr>
  <td>waitForPageToLoad</td>
  <td></td>
  <td></td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<tr>
  <td>waitForText</td>
  <td>//div[@id='AccountDetailsPortletView']/div/div/div/table/tbody/tr[1]/td</td>
  <td>Test Account ${randomSuffix}</td>
</tr>
<!--Go to create opportunity-->
<tr>
	<td>open</td>
	<td>index.php/opportunities/default</td>
	<td></td>
</tr>
<tr>
	<td>waitForPageToLoad</td>
	<td></td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Create</td>
	<td></td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Update</td>
	<td></td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Export</td>
	<td></td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Delete</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>//div[@id='OpportunitiesSecuredActionBarForSearchAndListView']/div/nav/div[1]/a/span</td>
	<td></td>
</tr>
<tr>
	<td>waitForPageToLoad</td>
	<td></td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Create Opportunity</td>
	<td></td>
</tr>
<!--check validation-->
<tr>
	<td>clickAndWait</td>
	<td>save</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForTextPresent</td>
	<td>Name cannot be blank.</td>
	<td></td>
</tr>
<tr>
	<td>waitForTextPresent</td>
	<td>Close Date cannot be blank.</td>
	<td></td>
</tr>
<!--check default values-->
<tr>
	<td>assertSelectedLabel</td>
	<td>Opportunity_amount_currency_id</td>
	<td>USD</td>
</tr>
<tr>
	<td>assertText</td>
	<td>Opportunity_amount_value</td>
	<td></td>
</tr>
<tr>
	<td>assertSelectedLabel</td>
	<td>Opportunity_stage_value</td>
	<td>Prospecting</td>
</tr>
<tr>
	<td>assertSelectedLabel</td>
	<td>Opportunity_source_value</td>
	<td>(None)</td>
</tr>
<!--add opportunity details-->
<tr>
  <td>type</td>
  <td>Opportunity_name</td>
  <td>Test Opportunity ${randomSuffix}</td>
</tr>
<tr>
	<td>select</td>
	<td>id=Opportunity_amount_currency_id</td>
	<td>label=EUR</td>
</tr>
<tr>
  <td>type</td>
  <td>Opportunity_amount_value</td>
  <td>500.34</td>
</tr>
<tr>
  <td>click</td>
  <td>Opportunity_account_SelectLink</td>
  <td></td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<tr>
  <td>waitForElementPresent</td>
  <td>AccountsSearchForm_anyMixedAttributes</td>
  <td></td>
</tr>
<tr>
  <td>type</td>
  <td>AccountsSearchForm_anyMixedAttributes</td>
  <td>Test Account ${randomSuffix}</td>
</tr>
<tr>
    <td>keyUp</td>
    <td>AccountsSearchForm_anyMixedAttributes</td>
    <td>\10</td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<tr>
  <td>waitForText</td>
  <td>//div[@id='list-viewmodal']/div[2]/table/tbody/tr[1]/td/a</td>
  <td>Test Account ${randomSuffix}</td>
</tr>
<tr>
  <td>click</td>
  <td>//div[@id='list-viewmodal']/div[2]/table/tbody/tr[1]/td/a</td>
  <td></td>
</tr>
<tr>
  <td>waitForValue</td>
  <td>Opportunity_account_name</td>
  <td>Test Account ${randomSuffix}</td>
</tr>
<tr>
  <td>assertNotValue</td>
  <td>Opportunity_account_id</td>
  <td></td>
</tr>
<tr>
  <td>type</td>
  <td>Opportunity_closeDate</td>
  <td>${month}/${date}/14</td>
</tr>
<tr>
  <td>select</td>
  <td>Opportunity_stage_value</td>
  <td>label=Negotiating</td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<tr>
  <td>select</td>
  <td>Opportunity_source_value</td>
  <td>label=Tradeshow</td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<tr>
  <td>type</td>
  <td>Opportunity_description</td>
  <td>test description</td>
</tr>
<tr>
  <td>click</td>
  <td>Opportunity_owner_SelectLink</td>
  <td></td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<tr>
  <td>waitForElementPresent</td>
  <td>UsersSearchForm_anyMixedAttributes</td>
  <td></td>
</tr>
<tr>
  <td>type</td>
  <td>UsersSearchForm_anyMixedAttributes</td>
  <td>Sam Smith</td>
</tr>
<tr>
    <td>keyUp</td>
    <td>UsersSearchForm_anyMixedAttributes</td>
    <td>\10</td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<tr>
    <td>waitForText</td>
    <td>//div[@id='list-viewmodal']/div[2]/table/tbody/tr[1]/td/a</td>
    <td>Sam Smith</td>
</tr>
<tr>
  <td>click</td>
  <td>link=Sam Smith</td>
  <td></td>
</tr>
<tr>
  <td>waitForValue</td>
  <td>Opportunity_owner_name</td>
  <td>Sam Smith</td>
</tr>
<tr>
  <td>assertNotValue</td>
  <td>Opportunity_owner_id</td>
  <td></td>
</tr>
<tr>
  <td>clickAndWait</td>
  <td>save</td>
  <td></td>
</tr>
<tr>
  <td>waitForPageToLoad</td>
  <td></td>
  <td></td>
</tr>
<tr>
  <td>waitForCondition</td>
  <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
  <td>30000</td>
</tr>
<!--verify values after creating opportunity-->
<tr>
	<td>assertTextPresent</td>
	<td>Test Opportunity ${randomSuffix}</td>
	<td></td>
</tr>
<tr>
	<td>setSpeed</td>
	<td>3000</td>
	<td></td>
</tr>
<tr>
	<td>assertText</td>
	<td>//div[@id='OpportunityDetailsPortletView']/div/div/div/table/tbody/tr[1]/td</td>
	<td>Test Opportunity ${randomSuffix}</td>
</tr>
<tr>
	<td>assertText</td>
	<td>//div[@id='OpportunityDetailsPortletView']/div/div/div/table/tbody/tr[2]/td</td>
	<td>€500.34</td>
</tr>
<tr>
	<td>assertText</td>
	<td>//div[@id='OpportunityDetailsPortletView']/div/div/div/table/tbody/tr[3]/td/a</td>
	<td>Test Account ${randomSuffix}</td>
</tr>
<tr>
	<td>assertText</td>
	<td>//div[@id='OpportunityDetailsPortletView']/div/div/div/table/tbody/tr[4]/td</td>
	<td>${month}/${date}/14</td>
</tr>
<tr>
	<td>assertText</td>
	<td>//div[@id='OpportunityDetailsPortletView']/div/div/div/table/tbody/tr[5]/td</td>
	<td>Negotiating</td>
</tr>
<tr>
	<td>assertText</td>
	<td>//div[@id='OpportunityDetailsPortletView']/div/div/div/table/tbody/tr[6]/td</td>
	<td>50%</td>
</tr>
<tr>
	<td>assertText</td>
	<td>//div[@id='OpportunityDetailsPortletView']/div/div/div/table/tbody/tr[7]/td</td>
	<td>Tradeshow</td>
</tr>
<tr>
	<td>assertText</td>
	<td>//div[@id='OpportunityDetailsPortletView']/div/div/div/table/tbody/tr[8]/td</td>
	<td>test description</td>
</tr>
<tr>
	<td>setSpeed</td>
	<td>0</td>
	<td></td>
</tr>
</tbody></table>
</body>
</html>